Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add payment module params #893

Merged
merged 47 commits into from
Nov 10, 2022

Conversation

rahulghangas
Copy link
Contributor

@rahulghangas rahulghangas commented Oct 20, 2022

Adds minSquareSize and maxSquareSize as params to the payment module.
Defines relevant stores and queries

Relevant changes in
proto/payment/*
x/payment/keeper*
x/payment/types/*

Note: The constants that currently define min/max square size have not been deprecated, will do so in another PR

Copy link
Member

@rach-id rach-id left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start 👍
Did a first pass and left some blocking comments.
Also, doesn't it make sense also to make the corresponding genesis changes?
I once set some parameters for the QGB, and I updated the following when init and export:
https://github.com/celestiaorg/celestia-app/blob/main/x/qgb/genesis.go

proto/payment/params.proto Outdated Show resolved Hide resolved
proto/payment/params.proto Outdated Show resolved Hide resolved
proto/payment/query.proto Outdated Show resolved Hide resolved
proto/payment/query.proto Outdated Show resolved Hide resolved
x/payment/keeper/params.go Outdated Show resolved Hide resolved
x/payment/keeper/params.go Outdated Show resolved Hide resolved
x/payment/types/params.go Outdated Show resolved Hide resolved
x/payment/types/params.go Outdated Show resolved Hide resolved
x/payment/types/params.go Outdated Show resolved Hide resolved
x/payment/types/params.go Outdated Show resolved Hide resolved
@rach-id rach-id added enhancement New feature or request C: Celestia app warn:api breaking item will be break an API and require a major bump labels Oct 20, 2022
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • golangci-lint is failing here (likely fixable via make fmt)
  • proto-gen is failing here (likely fixable via make proto-gen)

proto/payment/params.proto Outdated Show resolved Hide resolved
x/payment/keeper/params.go Outdated Show resolved Hide resolved
x/payment/types/params.go Outdated Show resolved Hide resolved
x/payment/types/params.go Outdated Show resolved Hide resolved
x/payment/types/params.go Outdated Show resolved Hide resolved
x/payment/types/params.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing feedback so quickly!

I'm observing the following panic when attempting to test the CLI query command.

$ celestia-appd query payment params
Error: rpc error: code = Unknown desc = parameter MinSquareSize not registered: panic

To reproduce this error, I checked out this branch locally and installed the binary (i.e make install)

message Params {
option (gogoproto.goproto_stringer) = false;

uint32 min_square_size = 1 [(gogoproto.moretags) = "yaml:\"min_square_size\""];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] for my learning, why is the "yaml:\"min_square_size\"" necessary? In the future, do we plan on reading this value from a YAML file? It looks like removing it has the following effect on params.pb.go:

 type Params struct {
-       MinSquareSize uint32 `protobuf:"varint,1,opt,name=min_square_size,json=minSquareSize,proto3" json:"min_square_size,omitempty" yaml:"min_square_size"`
-       MaxSquareSize uint32 `protobuf:"varint,2,opt,name=max_square_size,json=maxSquareSize,proto3" json:"max_square_size,omitempty" yaml:"max_square_size"`
+       MinSquareSize uint32 `protobuf:"varint,1,opt,name=min_square_size,json=minSquareSize,proto3" json:"min_square_size,omitempty"`
+       MaxSquareSize uint32 `protobuf:"varint,2,opt,name=max_square_size,json=maxSquareSize,proto3" json:"max_square_size,omitempty"`
 }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's standard practice from what I've seen. Also, it makes it very easy to define genesis parameters through a config.yml file

For eg. https://github.com/osmosis-labs/osmosis/blob/main/proto/osmosis/lockup/params.proto

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find a config.yml in https://github.com/osmosis-labs/osmosis so I'm not sure what you mean. Can you please elaborate or include a link to the file?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't understand the benefit to using yaml tags but this isn't blocking so feel free to resolve the conversation @rahulghangas if there aren't updates here

@rahulghangas
Copy link
Contributor Author

I'm observing the following panic when attempting to test the CLI query command.

$ celestia-appd query payment params
Error: rpc error: code = Unknown desc = parameter MinSquareSize not registered: panic

To reproduce this error, I checked out this branch locally and installed the binary (i.e make install)

Whoops, fixing this

Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!! these will be really useful in the future.

The constants that currently define min/max square size have not been deprecated, will do so in another PR

IMO, we should actually keep these, but just change them to be the defaults. This way other projects import really similar defaults without booting up an application.

x/payment/types/params.go Outdated Show resolved Hide resolved
x/payment/client/cli/query.go Outdated Show resolved Hide resolved
proto/payment/params.proto Outdated Show resolved Hide resolved
x/payment/keeper/grpc_query_params.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Oct 20, 2022

Codecov Report

Merging #893 (cab4172) into main (22d366f) will decrease coverage by 2.24%.
The diff coverage is 8.36%.

@@            Coverage Diff             @@
##             main     #893      +/-   ##
==========================================
- Coverage   29.74%   27.49%   -2.25%     
==========================================
  Files          72       81       +9     
  Lines        8199     9091     +892     
==========================================
+ Hits         2439     2500      +61     
- Misses       5531     6355     +824     
- Partials      229      236       +7     
Impacted Files Coverage Δ
app/app.go 6.44% <0.00%> (-0.06%) ⬇️
app/malleate_txs.go 71.87% <ø> (ø)
app/parse_txs.go 64.00% <ø> (ø)
app/process_proposal.go 0.00% <ø> (ø)
app/test_util.go 73.77% <ø> (ø)
x/blob/handler.go 0.00% <ø> (ø)
x/blob/keeper/msg_server.go 0.00% <ø> (ø)
x/blob/module.go 3.70% <ø> (ø)
x/blob/payfordata.go 0.00% <ø> (ø)
x/blob/types/builder_options.go 41.26% <ø> (ø)
... and 27 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In one terminal, I ran

make install
celestia-appd start

and in a separate terminal, I'm observing a new error now:

$ celestia-appd query payment params
Error: rpc error: code = Unknown desc = UnmarshalJSON cannot decode empty bytes: panic

@rahulghangas are you able to reproduce this?

testutil/nullify/nullify.go Outdated Show resolved Hide resolved
testutil/nullify/nullify.go Outdated Show resolved Hide resolved
x/payment/genesis_test.go Outdated Show resolved Hide resolved
x/payment/keeper/keeper.go Outdated Show resolved Hide resolved
x/payment/keeper/params.go Outdated Show resolved Hide resolved
x/payment/types/params.go Outdated Show resolved Hide resolved
x/payment/types/params.go Outdated Show resolved Hide resolved
@evan-forbes
Copy link
Member

@rootulp

In one terminal, I ran
make install
celestia-appd start
and in a separate terminal, I'm observing a new error now:

did you initialize the chain from scratch? the only way to set genesis values after upgrading binaries is to include it in an upgrade handler or perhaps vote on it. In a normal situation, it will be included in the genesis.

@rootulp
Copy link
Collaborator

rootulp commented Oct 25, 2022

did you initialize the chain from scratch?

Nope. Thanks for identifying my mistake. I just did and this command now works as expected

$ celestia-appd query payment params
params:
  max_square_size: 128
  min_square_size: 1

@rootulp
Copy link
Collaborator

rootulp commented Oct 26, 2022

[optional][can be a follow-up PR] we likely want to update https://github.com/celestiaorg/celestia-app/blob/main/x/payment/spec/docs.md#parameters

@rahulghangas rahulghangas force-pushed the feat/payment-module-params branch from fb7c394 to 8f00dc9 Compare October 31, 2022 15:34
evan-forbes
evan-forbes previously approved these changes Oct 31, 2022
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM utACK

x/payment/types/params.go Outdated Show resolved Hide resolved
testutil/nullify/nullify.go Outdated Show resolved Hide resolved
x/payment/genesis_test.go Outdated Show resolved Hide resolved
@rahulghangas rahulghangas dismissed stale reviews from rootulp and rach-id via 713ca62 November 10, 2022 06:42
Copy link
Member

@rach-id rach-id left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just some final comments

x/blob/types/params.go Show resolved Hide resolved
testutil/keeper/payment.go Outdated Show resolved Hide resolved
x/blob/types/params.go Outdated Show resolved Hide resolved
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets mergeeeeeeee

@rahulghangas rahulghangas merged commit a5272de into celestiaorg:main Nov 10, 2022
@rahulghangas rahulghangas deleted the feat/payment-module-params branch November 10, 2022 14:46
rahulghangas added a commit that referenced this pull request Nov 11, 2022
Adds `gasPerMsgByte` as params to the payment module. 
Defines relevant stores and queries

Relevant changes in 
`proto/payment/*`
`x/payment/keeper*`
`x/payment/types/*`

- [x] finished 1st part of #949

Note: To be merged after #893 and constants for default values can be
defined in a cumulative PR
rach-id pushed a commit to rach-id/celestia-app that referenced this pull request Nov 16, 2022
## TODO
- [x] Split out changes that are only relevant post ADR 008
implementation and target feature branch
- [x] Document gas cost for a message
- [x] [Potentially] remove outdated code blocks from README.md

## Future PRs
- [ ] Params section needs to be updated after params are added to
payment module celestiaorg#893
- [ ] [Potentially] add client section (motivated by
https://github.com/cosmos/cosmos-sdk/tree/main/x/auth#client)
rach-id pushed a commit to rach-id/celestia-app that referenced this pull request Nov 16, 2022
Adds `minSquareSize` and `maxSquareSize` as params to the payment
module.
Defines relevant stores and queries

Relevant changes in
`proto/payment/*`
`x/payment/keeper*`
`x/payment/types/*`

- [x] closes celestiaorg#183

Note: The constants that currently define min/max square size have not
been deprecated, will do so in another PR
rach-id pushed a commit to rach-id/celestia-app that referenced this pull request Nov 16, 2022
Adds `gasPerMsgByte` as params to the payment module. 
Defines relevant stores and queries

Relevant changes in 
`proto/payment/*`
`x/payment/keeper*`
`x/payment/types/*`

- [x] finished 1st part of celestiaorg#949

Note: To be merged after celestiaorg#893 and constants for default values can be
defined in a cumulative PR
rach-id pushed a commit to rach-id/celestia-app that referenced this pull request Nov 16, 2022
## TODO
- [x] Split out changes that are only relevant post ADR 008
implementation and target feature branch
- [x] Document gas cost for a message
- [x] [Potentially] remove outdated code blocks from README.md

## Future PRs
- [ ] Params section needs to be updated after params are added to
payment module celestiaorg#893
- [ ] [Potentially] add client section (motivated by
https://github.com/cosmos/cosmos-sdk/tree/main/x/auth#client)
rach-id pushed a commit to rach-id/celestia-app that referenced this pull request Nov 16, 2022
Adds `minSquareSize` and `maxSquareSize` as params to the payment
module.
Defines relevant stores and queries

Relevant changes in
`proto/payment/*`
`x/payment/keeper*`
`x/payment/types/*`

- [x] closes celestiaorg#183

Note: The constants that currently define min/max square size have not
been deprecated, will do so in another PR
rach-id pushed a commit to rach-id/celestia-app that referenced this pull request Nov 16, 2022
Adds `gasPerMsgByte` as params to the payment module. 
Defines relevant stores and queries

Relevant changes in 
`proto/payment/*`
`x/payment/keeper*`
`x/payment/types/*`

- [x] finished 1st part of celestiaorg#949

Note: To be merged after celestiaorg#893 and constants for default values can be
defined in a cumulative PR
rootulp added a commit that referenced this pull request Nov 23, 2022
0xchainlover pushed a commit to celestia-org/celestia-app that referenced this pull request Aug 1, 2024
## TODO
- [x] Split out changes that are only relevant post ADR 008
implementation and target feature branch
- [x] Document gas cost for a message
- [x] [Potentially] remove outdated code blocks from README.md

## Future PRs
- [ ] Params section needs to be updated after params are added to
payment module celestiaorg/celestia-app#893
- [ ] [Potentially] add client section (motivated by
https://github.com/cosmos/cosmos-sdk/tree/main/x/auth#client)
0xchainlover pushed a commit to celestia-org/celestia-app that referenced this pull request Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request warn:api breaking item will be break an API and require a major bump
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add the Max and MinSquareSize as a parameter to the payment module
5 participants